package com.kyzh.core.pager.weal.community.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.gushenge.core.beans.PhotoBean
import com.kyzh.core.R
import com.kyzh.core.databinding.ItemImgsBinding
import com.kyzh.core.utils.loadImage
import com.kyzh.core.utils.setVisibility

class ImageAdapter(list:ArrayList<PhotoBean>) :
    BaseQuickAdapter<PhotoBean, BaseDataBindingHolder<ItemImgsBinding>>(R.layout.item_imgs,list) {
    init {
        addChildClickViewIds(R.id.delect,R.id.img)
    }
    override fun convert(holder: BaseDataBindingHolder<ItemImgsBinding>, item: PhotoBean) {
        holder.dataBinding?.delect?.setVisibility(!item.isAdd)
        if(item.isAdd){
            holder.dataBinding?.img?.setImageResource(R.drawable.ic_addimgs)
        }else{
            holder.dataBinding?.img?.loadImage(item.url)
        }
    }
}